package com.adou.d13;

import java.util.LinkedList;

public class ListTest2 {
    public static void main(String[] args) {
        // 1.创建一个队列
        LinkedList<String> queue = new LinkedList<>();
        queue.addLast("1号人");
        queue.addLast("2号人");
        queue.addLast("3号人");
        queue.addLast("4号人");
        queue.addLast("5号人");
        System.out.println(queue);

        // 出队
        System.out.println("////////////////出队");
        System.out.println(queue.removeFirst());
        System.out.println(queue.removeFirst());
        System.out.println(queue.removeFirst());

        System.out.println("//////////////////- 遍历");
        System.out.println(queue);


        System.out.println("////////////////  栈");
        LinkedList<String> stack = new LinkedList<>();
        stack.addFirst("第1颗子弹");
        stack.addFirst("第2颗子弹");
        stack.addFirst("第3颗子弹");
        stack.addFirst("第4颗子弹");
        stack.addFirst("第5颗子弹");
        System.out.println(stack);
        System.out.println("////////////////  压栈");
        System.out.println(stack.removeFirst());
        System.out.println(stack.removeFirst());
        System.out.println(stack.removeFirst());

        System.out.println("//////////////////- 遍历");
        System.out.println(stack);



    }
}
